<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>全选效果</title>
	</head>
	<script>
		function quanXuan(){
			var ch=document.getElementsByTagName("input");
			for(var i=0;i<ch.length;i++){
				if(ch[0].checked==true){
					ch[i].checked=true;
				}else if(ch[0].checked==false){
					ch[i].checked=false;
				}
			}
		}
		function danXuan(){
			var dan=document.getElementsByTagName("input");
			for(var i=1;i<dan.length;i++){
				if(dan[i].checked==true){
					dan[0].checked=true;
				}
			}	
			if(dan[1].checked==false&&dan[2].checked==false&&dan[3].checked==false&&dan[4].checked==false){
					dan[0].checked=false;
				}
		}
	</script>
	<body>
		<div id="tab">
			<table bord
				er="0" cellspacing="10px" cellpadding="none">
				<tr></tr>
				<tr></tr>
				<tr></tr>
				<tr>
					<th><input type="checkbox" value="selectall" name="select" onclick="quanXuan()">全选</th>
					<th>商品图片</th>
					<th>商品名称/出售者/联系方式</th>
					<th>价格</th>
				</tr>
				<tr>
					<td></td>
					<td></td>
				</tr>
				<tr>
					<td><input type="checkbox" value="dobi" name="select" onclick="danXuan()"></td>
					<td><img src="img/list0.jpg"></td>
					<td>杜比环绕，家庭影院必备，超真实感受<br/>出售者：112233<br/><span><img src="img/online_pic.gif"></span><span><img src="img/list_tool_fav1.gif"/>收藏</span></td>
					<td>一口价<br/>2833.0</td>
				</tr>
				<tr>
					<td><input type="checkbox" value="nvd" name="select" onclick="danXuan()"></td>
					<td><img src="img/list1.jpg"></td>
					<td>nvdia 9999gt 512mb 256bit+极品显卡,不容错过<br/>出售者：223344<br/><span><img src="img/online_pic.gif"></span><span><img src="img/list_tool_fav1.gif"/>收藏</span></td>
					<td>一口价<br/>6464.0</td>
				</tr>
				<tr>
					<td><input type="checkbox" value="tvl" name="select" onclick="danXuan()"></td>
					<td><img src="img/list2.jpg"></td>
					<td>精品热卖，高清晰，30寸等离子电视<br/>出售者：334455<br/><span><img src="img/online_pic.gif"></span><span><img src="img/list_tool_fav1.gif"/>收藏</span></td>
					<td>一口价<br/>18888.0</td>
				</tr>
				<tr>
					<td><input type="checkbox" value="son" name="select" onclick="danXuan()"></td>
					<td><img src="img/list3.jpg"></td>
					<td>sony家用最新款笔记本<br/>出售者：445566<br/><span><img src="img/online_pic.gif"></span><span><img src="img/list_tool_fav1.gif"/>收藏</span></td>
					<td>一口价<br/>5889.0</td>
				</tr>
			</table>
		</div>
	</body>
	
</html>
